package com.gitee.sunstar.skbase

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment

abstract class SKBaseFragment<DB: ViewDataBinding>: Fragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val db:DB = DataBindingUtil.inflate(inflater,setLayoutId(),container,false)
        initView(db)
        return  db.root
    }

    abstract fun setLayoutId(): Int

    abstract fun initView(db: ViewDataBinding)

}